package com.tepth.vehiclemaintenance.mvp.login;

import com.tepth.vehiclemaintenance.bean.User;
import com.tepth.vehiclemaintenance.net.ApiModel;
import com.tepth.vehiclemaintenance.net.observer.SimpleDisposableObserver;

/**
 * Created by TMVPHelper on 2017/05/09
 */
public class LoginPresenter extends LoginContract.Presenter {

    @Override
    void login() {
        mRxManager.add(mModel.onLogin(mView.getAccount(), mView.getPassword())
                .subscribeWith(new SimpleDisposableObserver<ApiModel<User>>(mView) {
                    @Override
                    public void onSucceed(Object o) {
                        User user = (User) o;
                        mView.showUser(user);
                    }
                }));
    }
}